 {% extends "base.html" %}

{% block stylesheets %}
{% endblock %}

{% block content %}
<div class="jumbotron">
	<div class="container">
		<h1>Profile</h1>
	</div>
</div>
<div class="container">
	<div class="row">
		<div class="col-md-6 offset-md-3">
			{% if success %}
				<div class="alert alert-success alert-dismissable submit-row" role="alert">
					<strong>成功!</strong>
					你的个人资料已经更新啦~
					<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
				</div>
			{% else %}
				{% for error in errors %}
				<div class="submit-row">
					<div class="alert alert-danger alert-dismissable" role="alert">
					  <span class="sr-only">错误:</span>
					  {{ error }}
					  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
				  </div>
				</div>
				{% endfor %}
			{% endif %}
			{% if confirm_email %}
				<div class="alert alert-info alert-dismissable submit-row" role="alert">
					您的电子邮件地址未被确认！
					请检查您的电子邮件确认您的电子邮件地址。
					<br>
					<br>
					要发送确认电子邮件 <a href="{{ request.script_root }}/confirm">请点这里~</a>
					<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
							aria-hidden="true">×</span></button>
				</div>
			{% endif %}
			<form method="post" accept-charset="utf-8" autocomplete="off" role="form" class="form-horizontal">
				<div class="form-group">
					<label for="name-input">
						姓名：
					</label>
					<input class="form-control" type="text" name="name" id="name-input" value="{{name}}"/>
				</div>
				<div class="form-group">
					<label for="email-input">
						电子邮件地址：
					</label>
					<input class="form-control" type="email" name="email" id="email-input" value="{{email}}"/>
				</div>
				<div class="form-group">
					<label for="confirm-input">
						旧密码:
					</label>
					<input class="form-control" type="password" name="confirm" id="confirm-input" />
				</div>
				<div class="form-group">
					<label for="password-input">
						新密码：
					</label>
					<input class="form-control" type="password" name="password" id="password-input" />
				</div>

				<hr>

				<div class="form-group">
					<label for="affiliation-input">
						年级：
					</label>
					<input class="form-control" type="text" name="affiliation" id="affiliation-input" value="{% if affiliation %}{{affiliation}}{% endif %}" />
				</div>
				<div class="form-group">
					<label for="website-input">
						专业：
					</label>
					<input class="form-control" type="text" name="website" id="website-input" value="{% if website %}{{website}}{% endif %}" />
				</div>
				<div class="form-group">
					<label for="country-input">
						班级：
					</label>
					<input class="form-control" type="text" name="country" id="country-input" value="{% if country %}{{country}}{% endif %}" />
				</div>
				<div class="form-group">
					<button type="submit" id="submit" tabindex="5" class="btn btn-md btn-primary btn-outlined float-right">提交</button>
				</div>
				<input type="hidden" name="nonce" value="{{ nonce }}">
			</form>
		</div>
	</div>
</div>
{% endblock %}

{% block scripts %}
	<script src="{{ request.script_root }}/themes/{{ ctf_theme() }}/static/js/style.js"></script>
{% endblock %}
